<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:c="http://java.sun.com/jstl/core">

    <head>
    </head>
    
    <body>
        <ui:composition template="/templates/default.xhtml">
		 	<ui:define name="title">OpenHDS - Create Field Worker</ui:define>
		
			<ui:param name="crud" value="#{fieldWorkerCrud}" />
        
            <ui:define name="listing">
                <ui:include src="list.xhtml" />
            </ui:define>
            <ui:define name="display">
            
            	<h:outputText value="#{navController.breadcrumbTrail}" />
            
                <h1>#{msg.fieldWorkerCreate}</h1>
                <h:messages id="errors" globalOnly="true" />
                <h:form id="form">
                    <h:panelGrid columns="3">
                    
                    	<c:if test="#{fieldWorkerIdGenerator.generated == false}" >
                    		<h:outputText value="#{msg.fieldWorkerId}:" />
	                    	<h:inputText id="extId" value="#{fieldWorkerCrud.item.extId}" converter="#{defaultConverter}" />
							<h:message for="extId" errorClass="error" errorStyle="color: red" infoStyle="color: green"/>  
                    	</c:if>
                    
                        <h:outputText value="#{msg.fieldWorkerFirstName}:"/>
                        <h:inputText id="name" value="#{fieldWorkerCrud.item.firstName}" converter="#{defaultConverter}" />
                        <h:message for="name" errorClass="error" errorStyle="color: red" infoStyle="color: green"/>

                        <h:outputText value="#{msg.fieldWorkerLastName}:"/>
                        <h:inputText id="lastname" value="#{fieldWorkerCrud.item.lastName}" converter="#{defaultConverter}" />
                        <h:message for="lastname" errorClass="error" errorStyle="color: red" infoStyle="color: green"/>
                    </h:panelGrid>
                    <script>
		            	document.getElementById('form:name').focus();
		            	document.getElementById('form:extId').focus();
		            </script>
                    <br />
                    <h:commandButton action="#{fieldWorkerCrud.create}" value="#{msg.lblCreate}"/>
                </h:form>
            </ui:define>
        </ui:composition>
    </body>
</html>